package com.example.demo.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import com.example.demo.dto.SearchInfo;
import com.example.demo.entity.Department;
import com.example.demo.entity.User;
import com.example.demo.entity.Ward;



@Repository()
public interface Ward_Mapper extends BaseMapper<Ward>{
	@Select("select ward.*,department.name department_name "
			+ " from ward inner join department on ward.department_id=department.id   ${where} ${limitstr}")
	public List<Ward> select(SearchInfo info);
	@Select("select count(1) from ward inner join department on ward.department_id=department.id   ${where} ")
	public long selectCount(SearchInfo info);
	
	@Insert("insert into ward (bednum,department_id,state) values(#{bednum},#{department_id},#{state})")
	public void insert (Ward w);
	
	@Update("update ward set bednum=#{bednum},department_id=#{department_id},state=#{state} where id=#{id}")
	public void update (Ward w);
	
	
	@Select("delete from ward where id=#{id}")
	public void delete(int id);
	
	@Select("select * from ward where id=#{id} ")
	public Ward selectById(int id);
	
}
